var PageStatKey = "www.taosijie.com.chrometool.PageStatSwitch";
var DebugKey = "www.taosijie.com.chrometool.DebugSwitch";
var AutoClickKey = "www.taosijie.com.chrometool.AutoClickSwitch"

// 获取本地存储值
function GetLocalStorageValue(key){
    if(window.localStorage){
        var value = window.localStorage.getItem(key);
        return value;
    }
    return null;
}

chrome.extension.onRequest.addListener(function(request, sender, sendResponse) {
    switch (request.type) {
        case "switchlist":
            var IsPageStatOpen = true;
            if(GetLocalStorageValue(PageStatKey) == "open"){
            }else{
                IsPageStatOpen = false;
            }
            var IsDebugOpen = false;
            if(GetLocalStorageValue(DebugKey) == "open"){
                IsDebugOpen = true;
            }else{
            }
            var IsAutoClickOpen = false;
            if(GetLocalStorageValue(AutoClickKey) == "open"){
                IsAutoClickOpen = true;
            }else{
            }
            sendResponse({PageStatSwitch:IsPageStatOpen, DebugSwitch:IsDebugOpen, AutoClickSwitch:IsAutoClickOpen});
            break;
        default: break;
    }
});


